package com.andy.eqm.server.entity;

import java.util.List;

import com.andy.eqm.server.game.GameUser;
import com.google.common.collect.Lists;

public class ConfMake extends BaseEntity{

	private static final long serialVersionUID = 1L;

	public ConfMake() {
	}
	
	public ConfMake(Long id) {
		super(id);
	}
	
	private int itemId; // 物品id
	private int itemId1; // 物品id1
	private int itemId2; // 物品id2
	private int itemId3; // 物品id3
	private int itemId4; // 物品id4
	private int itemId5; // 物品id5
	private int itemId6; // 物品id6
	private int itemc1; // 消耗1
	private int itemc2; 
	private int itemc3; 
	private int itemc4; 
	private int itemc5; 
	private int itemc6; 
	
	public static String table() {
		return "conf_make";
	}

	public int getItemId() {
		return itemId;
	}

	public void setItemId(int itemId) {
		this.itemId = itemId;
	}

	public int getItemId1() {
		return itemId1;
	}

	public void setItemId1(int itemId1) {
		this.itemId1 = itemId1;
	}

	public int getItemId2() {
		return itemId2;
	}

	public void setItemId2(int itemId2) {
		this.itemId2 = itemId2;
	}

	public int getItemId3() {
		return itemId3;
	}

	public void setItemId3(int itemId3) {
		this.itemId3 = itemId3;
	}

	public int getItemId4() {
		return itemId4;
	}

	public void setItemId4(int itemId4) {
		this.itemId4 = itemId4;
	}

	public int getItemId5() {
		return itemId5;
	}

	public void setItemId5(int itemId5) {
		this.itemId5 = itemId5;
	}

	public int getItemId6() {
		return itemId6;
	}

	public void setItemId6(int itemId6) {
		this.itemId6 = itemId6;
	}

	public int getItemc1() {
		return itemc1;
	}

	public void setItemc1(int itemc1) {
		this.itemc1 = itemc1;
	}

	public int getItemc2() {
		return itemc2;
	}

	public void setItemc2(int itemc2) {
		this.itemc2 = itemc2;
	}

	public int getItemc3() {
		return itemc3;
	}

	public void setItemc3(int itemc3) {
		this.itemc3 = itemc3;
	}

	public int getItemc4() {
		return itemc4;
	}

	public void setItemc4(int itemc4) {
		this.itemc4 = itemc4;
	}

	public int getItemc5() {
		return itemc5;
	}

	public void setItemc5(int itemc5) {
		this.itemc5 = itemc5;
	}

	public int getItemc6() {
		return itemc6;
	}

	public void setItemc6(int itemc6) {
		this.itemc6 = itemc6;
	}

	public Integer[] buildItem(GameUser user) {
		List<Integer> result = Lists.newArrayList(7);
		if(itemId1 > 0){
			user.addItem(itemId1, -itemc1);
			result.add(itemId1);
		}
		if(itemId2 > 0){
			user.addItem(itemId2, -itemc2);
			result.add(itemId2);
		}
		if(itemId3 > 0){
			user.addItem(itemId3, -itemc3);
			result.add(itemId3);
		}
		if(itemId4 > 0){
			user.addItem(itemId4, -itemc4);
			result.add(itemId4);
		}
		if(itemId5 > 0){
			user.addItem(itemId5, -itemc5);
			result.add(itemId5);
		}
		if(itemId6 > 0){
			user.addItem(itemId6, -itemc6);
			result.add(itemId6);
		}
		
		user.addItem(itemId, 1);
		
		result.add(itemId);
		return result.toArray(new Integer[0]);
	}



}
